<%-- 
    Document   : aPost
    Created on : 2011-9-21, 21:12:03
    Author     : Frank
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="efrei.ete.bean.Floor"%>
<%@page import="efrei.ete.util.Util"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>A Post</title>
        <script type="text/JavaScript">
            function onclick_btnSub(){
                var replyDetail=document.getElementById("replyDetail").value;
                alert(replyDetail);
            }
            function onkeyup_txtr(obj)
            {
                var maxChars = 100;//max number of letters
                if (obj.value.length > maxChars)
                    obj.value = obj.value.substring(0,maxChars);
                var curr = maxChars - obj.value.length;
                document.getElementById("count").innerHTML = curr.toString();
            }
        </script>
    </head>
    <body>
        <p><img src="tree_root.gif" alt="Home" width="18" height="18" /> &gt; Communication platform &gt; theme name</p>
        <table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
            <%
                session.setAttribute("postIdCurrent", 1);
                session.setAttribute("authorId", 1);
                int postId = Integer.parseInt(session.getAttribute("postIdCurrent").toString());
                Floor headFloor = Util.getHead(postId);
            %>
            <tr>
                <td height="300" width="153" rowspan="2" bordercolor="#000000">
                    <p>HEAD</p>
                    <p>BY <%=Util.getNameById(headFloor.getAuthorID())%></p>
                </td>
                <td width="547">
                    <label>
                        <%=Util.timeToString(headFloor.getPostTime())%>
                    </label>
                    <label>
                        <input name="Submit3" type="submit" value="reply" />
                    </label><label>
                        <input name="Submit4" type="submit" value="sub" />
                    </label>
                </td>
            </tr>
            <tr>
                <td height="250">
                    <%=headFloor.getMessage()%>
                </td>
            </tr>
            <%
                ArrayList<Floor> floorInPost = Util.getFloorListByPostId(postId);
                for (int i = 0; i < 10; i++) {
                    out.println("<tr>"
                            + "<td height=\"300\" rowspan=\"2\" bordercolor=\"#000000\">"
                            + "Poster Infor"
                            + "</td>"
                            + "<td>"
                            + "<p>"
                            + "Post Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
                            + "<input name=\"Submit52\" type=\"submit\" value=\"Reply\" />"
                            + "<input name=\"Submit222\" type=\"submit\" value=\"Quato\" />"
                            + "</p>"
                            + "</td>"
                            + "</tr>"
                            + "<tr>"
                            + "<td height=\"300\">"
                            + "<p>"
                            + "Detail"
                            + "</p>"
                            + "</td>"
                            + "</tr>");
                }
            %>
            <tr>
                <td rowspan="2" bordercolor="#000000">
                    <p>REPLY HERE</p>
                </td>
                <td>Type Emotion Link</td>
            </tr>
            <tr>
                <td>
                    <div style="border:#930; border:groove">
                        <p>
                            &nbsp;&nbsp;&nbsp;
                            <label for="replyDe"></label>
                            <textarea name="replyDe" id="replyDetail" cols="45" rows="5" style="width:300px;height:100px" onkeyup="onkeyup_txtr(this)"></textarea>
                        </p>
                        <p>
                            &nbsp;&nbsp;&nbsp;You can still input <span id="count">100</span> words
                        </p>
                    </div>
                    <div style="border:#930; border:groove">
                        <p>
                            &nbsp;&nbsp;&nbsp;Please choose the file you want to upload<br/>
                        </p>
                        <p>
                            &nbsp;&nbsp;&nbsp;
                            <input type="file" name="ulFile" id="ulFile"/>
                            <input type="submit" value="Upload" />
                        </p>
                    </div>
                    <p>
                        &nbsp;&nbsp;&nbsp;
                        <label>
                            <input name="btnSub" id="btnSub" type="button" value="Submit" onclick="onclick_btnSub()"/>
                        </label>
                        <label>
                            <input name="btnGBTH" type="button" value="Go Back To HEAD" onclick="javascript:window.scroll(0,-360)"/>
                        </label>
                    </p>
                </td>
            </tr>
        </table>
    </body>
</html>